import re

import requests
name = "摩天大楼"
url = "http://www.22lrc.com/search.php?keyword={}&radio=0".format(name)
pre_lrc_url = "http://www.22lrc.com/"
heards = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36"
}

resp = requests.get(url=url, headers=heards)
resp.encoding = 'utf-8'
t = resp.text

obj = re.compile(r'<a class="adw" href="(?P<ul>.*?)">下载</a>', re.S)

lrc_url = pre_lrc_url + obj.findall(t)[0]

lrc_file = requests.get(url=lrc_url, headers=heards).content
print(lrc_file)
with open("./文件/" + name + ".lrc", mode="wb") as f:
    f.write(lrc_file)
